#include <bits/stdc++.h>
using namespace std;
#define int long long

int n, k;
const int p = 998244353;
long long qpow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) res = res * a % p;
		b >>= 1;
		a = a * a % p;
	}
	return res;
}
namespace CR200J {
	int a[11], ans, vis[11];
	void huans() {
		memset(vis, 0, sizeof(vis));
		int tot = 0;
		for (int i = 1; i <= n; ++i) {
			if (!vis[i]) {
				int fx = i;
				while (1) {
					if (vis[fx] == -1) {
						fx = i;
						while (vis[fx] != -1) {
							vis[fx] = -1;
							//cout << "set " << fx << " " << -1 << "\n";
							fx = a[fx];
						}
						goto end;
					}
					else if (vis[fx]) {
						//cout << tot << " " << vis[fx] << "\n";
						(ans += qpow(tot - vis[fx] + 1, k)) %= p;
						fx = i;
						while (vis[fx] != -1) {
							vis[fx] = -1;
							//cout << "set " << fx << " " << -1 << "\n";
							fx = a[fx];
						}
						goto end;
					} else {
						vis[fx] = ++tot;
						//cout << "set " << fx << " " << tot << "\n";
						fx = a[fx];
					}
				}
			}
end:;
		}
	}
	void dfs(int i) {
		if (i == n + 1) {
			huans();
			return;
		}
		for (int j = 1; j <= n; ++j) {
			a[i] = j;
			dfs(i + 1);
			a[i] = 0;
		}
	}
	void main() {
		ans = 0;
		dfs(1);
		cout << ans << "\n";
	}
}

namespace CR400AF {
	void main() {
	}
}

signed main() {
	freopen("length.in", "r", stdin);
	freopen("length.out", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	if (n <= 7) {
		CR200J::main();
	}
}
